package org.spitter.core.service.impl;

import java.util.List;

import org.spitter.core.dao.EntityJpaDao;
import org.spitter.core.dao.SpittleDao;
import org.spitter.core.model.Spitter;
import org.spitter.core.model.Spittle;
import org.spitter.core.service.SpittleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Service
public class SpittleServiceImpl extends BaseServiceImpl<Spittle> implements
		SpittleService {

	@Autowired
	@Qualifier("spittleDaoImpl")
	public void setEntityJpaDao(EntityJpaDao<Spittle> entityJpaDao) {
		this.entityJpaDao = entityJpaDao;
	}

	@Override
	public List<Spittle> getRecentSpittles(int no) {
		return ((SpittleDao) entityJpaDao).getRecentSpittles(no);
	}

	@Override
	public List<Spittle> getSpittlesForSpitter(Spitter spitter) {
		return ((SpittleDao) entityJpaDao).findBySpitter(spitter);
	}
}
